﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
using SQLite;

namespace TabbedTemplate.Models
{
    [Table("PunchInfo")]
    public class TrackablePunchInfo:PunchInfo
    {
        

        public override string Store_Uid
        {
            get=>base.Store_Uid;
            set
            {
                base.Store_Uid = value;
                Updated = true;
            }
        }

        public override long Timestamp
        {
            get=>base.Timestamp;
            set
            {
                base.Timestamp = value;
                Updated = true;
            }
        }

        public override string Content
        {
            get=>base.Content;
            set
            {
                base.Content = value;
                Updated = true;
            }
        }
        /// <summary>
        /// 是否更新。
        /// </summary>
        [Ignore]
        [JsonIgnore]
        public bool Updated { get; private set; }

        public TrackablePunchInfo(PunchInfo punchInfo)
        {
            Id = punchInfo.Id;
            base.Content = punchInfo.Content;
            base.Store_Uid = punchInfo.Store_Uid;
            base.Timestamp = punchInfo.Timestamp;
        }
        public TrackablePunchInfo CloneAsUpdated()
        {
            return new TrackablePunchInfo(this) { Updated = true };
        }

    }
}
